package tree;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

public class XzqDao {

	public List<XzqEntity> select() {
		Connection conn = null;
		Statement stmt = null;
		final String sql = "SELECT  * FROM cjkj_tree t; ";
		final List<XzqEntity> xzqEntityList = new ArrayList<XzqEntity>();
		try {
			conn = ConnectionPool.getConnection();
			// System.out.println("--------------------------coonection ID：" +
			// conn.toString());
			stmt = conn.createStatement();
			ResultSet resultSet = stmt.executeQuery(sql);
			int i = 0;
			while (resultSet.next()) {
				XzqEntity xzqEntity1 = new XzqEntity();
				xzqEntity1.setAddvcd(resultSet.getString("wellcode"));
				if (resultSet.getString("wellgroupcode") == null || resultSet.getString("wellgroupcode").equals("")) {
					// System.out.println(resultSet.getString("wellname"));
					// System.out.println(resultSet.getString("paddvcd"));
					// System.out.println(resultSet.getString("wellname"));
					xzqEntity1.setPaddvcd("");
				} else {
					xzqEntity1.setPaddvcd(resultSet.getString("wellgroupcode"));
				}
				xzqEntity1.setAddvnm(resultSet.getString("wellname"));
				xzqEntity1.setPaddvcdnm(resultSet.getString("wellgroupname"));
				xzqEntity1.setWellcode(resultSet.getString("wellcode"));
				xzqEntityList.add(xzqEntity1);

			}
			stmt.close();
			conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return xzqEntityList;
	}
}
